Cleanup retrySendTimeout func creation#1872
Conversation
WalkthroughThe pull request introduces a refactoring change in the The core logic of the function remains consistent, with the primary change being the extraction and separation of the function definition. The refactored implementation maintains the original behavior of attempting to send a The overall functionality of the ✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
pkg/wshutil/wshrpc.go (1)
748-752: Consider adding a maximum retry limit.While the current implementation works, it could potentially run indefinitely if the channel remains full and the server isn't done. Consider adding a maximum retry limit or an exponential backoff strategy.
+ maxRetries := 50 // 5 seconds total (50 * 100ms) + retryCount := 0 for { if done() { return } + retryCount++ + if retryCount >= maxRetries { + log.Printf("Failed to send timeout after %d attempts for resId: %s", maxRetries, resId) + return + } time.Sleep(100 * time.Millisecond) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
pkg/wshutil/wshrpc.go(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Build for TestDriver.ai
- GitHub Check: Analyze (go)
🔇 Additional comments (1)
pkg/wshutil/wshrpc.go (1)
735-747: LGTM! Clean and thread-safe implementation.The
donefunction is well-structured with proper lock handling and clear control flow. The implementation correctly handles both server termination and channel send attempts.
No description provided.